import requests


class Base:
    def __init__(self,url, headers, case):
        self.url = url
        self.headers = headers
        self.case = case

    def send_post(self):
        response = requests.post(url=self.url, headers=self.headers, json=self.case)
        if response.status_code == 200:
            content = response.json()
            # data = content.get("data")
            return response.status_code, content
        else:
            return response.status_code, None

    def send_get(self):
        response = requests.get(url=self.url, headers=self.headers, json=self.case)
        if response.status_code == 200:
            content = response.json()
            # data = content.get("data")
            return response.status_code, content
        else:
            return response.status_code, None

    def send_put(self):
        response = requests.put(url=self.url, headers=self.headers, json=self.case)
        if response.status_code == 200:
            content = response.json()
            # data = content.get("data")
            return response.status_code, content
        else:
            return response.status_code, None
